"""
依赖项
"""

from utils.exception_utils import AuthenticationError


async def login_required() -> None:
    """ 登录认证 | 依赖项 """

    from components.global_param import get_ctx

    if not get_ctx().is_authenticated:
        raise AuthenticationError("请先登录用户")


async def admin_required() -> None:
    """ 管理员认证 | 依赖项 """

    from components.global_param import get_ctx

    if not get_ctx().is_authenticated:
        raise AuthenticationError("请先登录管理员")

    if not get_ctx().is_admin:
        raise AuthenticationError("非管理员无权限访问")
